<template>
  <div>
    <header>
      <h1>大数据可视化-Vue3+Echarts</h1>
    </header>
    <!-- 大容器 -->
    <section class="container">
      <!-- 左 -->
      <section class="itemLeft">
        <item-page>
          <itemOne></itemOne>
        </item-page>
        <item-page>
          <itemTwo></itemTwo>
        </item-page>
      </section>
      <!-- 中 -->
      <section class="itemCenter" ref="map"></section>
      <!-- 右 -->
      <section class="itemRight">
        <item-page>
          <itemThree></itemThree>
        </item-page>
        <item-page>
          <itemFour></itemFour>
        </item-page>
      </section>
    </section>
  </div>
</template>

<script>
import itemPage from "@/components/itemPage.vue";
import itemOne from "@/components/itemOne.vue";
import itemTwo from "@/components/itemTwo.vue";
import itemThree from "@/components/itemThree.vue";
import itemFour from "@/components/itemFour.vue";
import { mapData } from "../assets/mapData.js";
import { inject } from "vue";
export default {
  components: {
    itemPage,
    itemOne,
    itemTwo,
    itemThree,
    itemFour,
  },
  setup() {
    let option = {
      geo: {
        type: "map",
        map: "chinaMap",
        roam: true, //平移缩放
        // zoom:1,
        center: [116.387803, 39.940361],
      },
      series: {
        // 散点图
        type: "scatter",
        data: [
          {
            name: "北京市",
            value: [116.46, 
            39.92, 
            4000
            ]
          },
        ],
        coordinateSystem:"geo",
        symbolSize:30,
        label:{show:true}
      },
    };
    return {
      option,
    };
    // let $http = inject("axios")
  },
  mounted() {
    let $echarts = inject("echarts");
    let myChart = $echarts.init(this.$refs.map);
    $echarts.registerMap("chinaMap", mapData);
    myChart.setOption(this.option);
  },
};
</script>

<style lang="less">
header {
  height: 1rem;
  width: 100%;
  background-color: rgb(0, 0, 255, 0.2);
  h1 {
    font-size: 0.375rem;
    color: #fff;
    text-align: center;
    line-height: 44px;
  }
}
.container {
  // 最大最小宽度
  min-width: 1200px;
  max-width: 2048px;
  margin: 0 auto;
  // border: 1px solid red;
  padding: 10px 10px 0;
  // background-color: gray;
  display: flex;
  // 设置左右
  .itemLeft,
  .itemRight {
    flex: 3;
  }
  .itemCenter {
    flex: 5;
    height: 740px;
    border: 1px solid blue;
    padding: 10px;
    margin: 20px;
    background-color: rgba(12, 130, 255, 0.85);
  }
}
</style>
